namespace SharpGraphT.Graph;

public class AsUnmodifiableGraph<TV, TE> : GraphDelegator<TV, TE>
    where TE : class, new() {
    private static readonly long SerialVersionUid = -8186686968362705760L;

    private static readonly string Unmodifiable = "this graph is unmodifiable";

    public AsUnmodifiableGraph(IGraph<TV, TE> g) : base(g) { }

    public override TE AddEdge(TV sourceVertex, TV targetVertex) =>
        throw new InvalidOperationException(Unmodifiable);

    public override bool AddEdge(TV sourceVertex, TV targetVertex, TE e) =>
        throw new InvalidOperationException(Unmodifiable);

    public override TV AddVertex() =>
        throw new InvalidOperationException(Unmodifiable);

    public override bool AddVertex(TV v) =>
        throw new InvalidOperationException(Unmodifiable);

    public override bool RemoveAllEdges<TEe>(IEnumerable<TEe> edges) =>
        throw new InvalidOperationException(Unmodifiable);

    public override IReadOnlySet<TE> RemoveAllEdges(TV sourceVertex, TV targetVertex) =>
        throw new InvalidOperationException(Unmodifiable);

    public override bool RemoveAllVertices<TVv>(ICollection<TVv> vertices) =>
        throw new InvalidOperationException(Unmodifiable);

    public override bool RemoveEdge(TE e) =>
        throw new InvalidOperationException(Unmodifiable);

    public override TE RemoveEdge(TV sourceVertex, TV targetVertex) =>
        throw new InvalidOperationException(Unmodifiable);

    public override bool RemoveVertex(TV v) =>
        throw new InvalidOperationException(Unmodifiable);

    public override IGraphType Type => base.Type.AsUnmodifiable();
}